//****************************************************************************
// chainwriter.h
// contains the declarations and defenitions of the ChainWriter class
//
// Author: Einat Zuker
//****************************************************************************
#ifndef CHAINWRITER_H
#define CHAINWRITER_H

#include <fstream>
#include <list>
#include <vector>
#include <string>
#include <iostream>

using std::streampos;
using std::ofstream;
using std::list;
using std::vector;
using std::string;
using std::exception;

//*****************************************************************************
// ChainWriterExepetion
// implements the Chain Writer Exepetion interface
//*****************************************************************************
class ChainWriterExepetion : public exception
{
private:
	string m_ErrorDescription;
	
public:
	ChainWriterExepetion(string description)
	{
		exception::exception();
		m_ErrorDescription = description;	
	}

	string GetErrorDescription()
	{
		return m_ErrorDescription;
	}
};

//*****************************************************************************
// ChainWriter
// A class to define the Chain Writer interface
//*****************************************************************************
class ChainWriter
{
public:
	ChainWriter(string fileName);
	~ChainWriter();
	void SetBinaryWordLength(int n);
	void SetBinaryWordWeight(int w);
	void SetNumberOfGroups(int newNumber);
	void SetFirstVertex(int groupId, vector<bool> *vertexName);
	void SetNextVertex(vector<bool> *vertexName);
	void SetGroupSummary(string title, int* groupSizes);

private:
	ofstream  m_File;
	int	m_BinaryWordLength;
	int m_NumberOfGroups;
};

#endif //CHAINWRITER_H